class String{
    constructor(s){
        this.str = s;
    }
    query(){
        let obj = {};
        let arr1 = [];
        let a = this.str.split('&');
        // console.log(a);
        a.forEach( item=>{
            arr1 = item.split('=');
            // console.log(arr1);
            obj[arr1[0]] = arr1[1];
            // console.log(obj);
        } )
            
        return obj;
    }
}
const stringObj = new String('id=1&name=lisi&age=18');
console.log(stringObj.query());